<template>
    <div class="batchGeneration">
        <el-dialog title="提现记录" :visible.sync="dialogFormVisible">
            <slot></slot>
            <div class="batchGeneration-table">
                <el-table :data="tableData" border v-loading="loading" style="width: 100%">
                    <el-table-column
                        v-for="(item, index) in tableList"
                        :key="index"
                        :prop="item.prop"
                        :label="item.label"
                        :align="'center'"
                    >
                        <template v-if="item.prop == 'createTime'" scope="scope">
                            {{ getTime(scope.row.createTime) }}
                        </template>
                        <!-- <template v-else-if="item.prop == 'status'" scope="scope">
                            {{ scope.row.status == 'NORMAL' ? '成功' : '失败' }}
                        </template> -->
                    </el-table-column>
                    <el-table-column label="操作" :align="'center'">
                        <template slot-scope="scope">
                            <el-button @click="delectItem(scope.row)" style="color: red" type="text" size="small">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <!-- <div class="pagination">
                    <el-pagination
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page="page"
                        :page-sizes="[10, 20, 30]"
                        :page-size="pageSize"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="40"
                    >
                    </el-pagination>
                </div> -->
            </div>

            <div slot="footer" class="dialog-footer">
                <el-button :loading="loading" type="primary" @click="generate">返 回</el-button>
            </div>
        </el-dialog>
    </div>
</template>
  <script>
import request from '../../../utils/request';
import { getListTime } from '@/utils/Time';
export default {
    name: 'batchGeneration',
    data() {
        return {
            dialogFormVisible: false,
            loading: false,
            num: 0,
            page: 1,
            pageSize: 10,
            tableData: [{ id: '250', code: '测试', time: '2024-4-30' }],
            tableList: [
                { label: '提现时间', prop: 'createTime' },
                { label: '提现金额', prop: 'amount' },
                { label: '状态', prop: 'status' }
            ],
            info: {},
            values:null
        };
    },
    methods: {
        // 确定
        confirm() {
            dialogFormVisible = false;
        },
        // 删除
        delete(row) {},
        // 生成
        generate() {
            this.dialogFormVisible = false;

            // this.loading = true;
            // request({
            //     url: `/admin/auth-code/v1/batch-gen/${this.num}`,
            //     method: 'post'
            //     // params: {
            //     //   genNum: this.num
            //     // }
            // }).then((res) => {
            //     this.dialogFormVisible = false;
            //     this.$message.success('操作成功');
            //     this.$emit('batchgen');
            // });
        },
        //
        handleSizeChange() {},
        handleCurrentChange() {},
        getlist(item) {
            this.values = item
            console.log(item);
            request({
                url: `/admin/user/v1/cash-log`,
                method: 'post',
                data: {
                    cashAmount: item.cashedAmount,
                    frozenAmount: item.frozenAmount,
                    id: item.id
                }
            }).then((res) => {
                console.log(res.data.cashLogList);
                // cashLogList
                this.tableData = res.data.cashLogList;
                this.dialogFormVisible = true;
            });
        },
        getTime(e) {
            return getListTime(e);
        },
        delectItem(e) {
            console.log(e);
            request({
                url: `/admin/user/v1/cash-log-del`,
                method: 'post',
                params: {
                    id: e.id
                }
            }).then((res) => {
                console.log(res.data);
                this.$message.success('操作成功');

                this.getlist(this.values);
            });
        }
    }
};
</script>
  <style scoped>
.batchGeneration-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
}
.batchGeneration-header > .input {
    margin-left: 10px;
    margin-right: 15px;
}
</style>